import { createApp } from 'vue'

import Cookies from 'js-cookie'

import ElementPlus from 'element-plus'
import locale from 'element-plus/es/locale/lang/zh-cn' // 中文语言
import 'element-plus/dist/index.css'
import './index.css'

import App from './App'
import router from './router'
import directive from './directive' // directive

import dayjs from "dayjs"

import 'default-passive-events' //passive event listener

// 注册指令
import plugins from './plugins' // plugins
import { download } from '@/utils/request'

// svg图标
import 'virtual:svg-icons-register'

import './permission' // permission control

import { parseTime, resetForm, addDateRange, handleTree, selectDictLabel, selectDictLabels, splitArray, portalConfirm } from '@/utils/common'



const app = createApp(App)

// 全局方法挂载
app.config.globalProperties.download = download
app.config.globalProperties.parseTime = parseTime
app.config.globalProperties.resetForm = resetForm
app.config.globalProperties.handleTree = handleTree
app.config.globalProperties.addDateRange = addDateRange
app.config.globalProperties.selectDictLabel = selectDictLabel
app.config.globalProperties.selectDictLabels = selectDictLabels
app.config.globalProperties.splitArray = splitArray
app.config.globalProperties.portalConfirm = portalConfirm
app.config.globalProperties.root_width = 1200
app.config.globalProperties.dayjs = dayjs
import VueVideoPlayer from '@videojs-player/vue'
import 'video.js/dist/video-js.css'
// 全局组件挂载
app.use(VueVideoPlayer)
app.use(router)
app.use(plugins)

directive(app)

// 使用element-plus 并且设置全局的大小
app.use(ElementPlus, {
  locale: locale,
  // 支持 large、default、small
  size: Cookies.get('size') || 'default'
})

app.mount('#app')
